package com.lesent.kafka;

import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * @author shengtao
 * @Description:
 * @date 2018/08/10 9:55
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = KafkaApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class test {


    @LocalServerPort
    private  int port;

    @Autowired
    private TestRestTemplate restTemplate;

    private URL base;

    @Before
    void configre() throws MalformedURLException {
        String url = String.format("http://localhost:%d/", port);
        System.out.println(String.format("port is : [%d]", port));
        this.base = new URL(url);
    }

    //test测试


}
